<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /*  */
        function f() {
            console.log(this.x);
        }
        f();
        var x = 2;
        var a = {x: 1, y: 2};
        a.f = f;
        var b = a.f;
        a.f();
        b();

        console.log("f" in a);

        /*  */
        var obj = new Object();
        var obj2 = obj;

        obj.name = 345
        obj2.name = 123;

        obj2 = null;

        console.log(obj);
        console.log(obj2);

        /*  */
        function setName(obj){
            obj.name = "123";
            obj = new Object();
            obj.name = "456"
        }
        let person = new Object();
        setName(person);
        console.log(person.name);

        /*  */
        var c = 33;
        function fn(){
            c = 10;
            console.log("c = " + c);
        }
        fn();

        /* this练习*/
        var name = "全局";

        function sayName(){
            console.log(this.name);
        }

        fn();

        var obj11 = {
            name: "11",
            sayName: sayName
        }
        var obj22 = {
            name: "22",
            sayName: sayName
        }

        obj11.sayName();
        obj22.sayName();

    </script>
</body>
</html>